#include "stdafx.h"

template <typename T, typename C> void ArrayToString(T& container, std::basic_string<C>& outStr)
{
    typename T::iterator itBeg = container.begin();
    typename T::iterator itEnd = container.end();
    std::stringstream stream;

    while (itBeg != itEnd)
    {
        stream << std::hex << static_cast<int>(*itBeg);

        ++itBeg;
    }
    outStr = stream.str();
}

int main()
{
	std::vector<char> vChar;
	vChar.push_back(0x45);
	vChar.push_back(0x67);

	std::list<char> lChar;
	lChar.push_back(0x45);
	lChar.push_back(0x67);

	std::deque<char> dChar;
	dChar.push_back(0x45);
	dChar.push_back(0x67);

	std::vector<unsigned char> vUnsignedChar;
	vUnsignedChar.push_back(0x45);
	vUnsignedChar.push_back(0x67);

	std::list<unsigned char> lUnsignedChar;
	lUnsignedChar.push_back(0x45);
	lUnsignedChar.push_back(0x67);

	std::deque<unsigned char> dUnsignedChar;
	dUnsignedChar.push_back(0x45);
	dUnsignedChar.push_back(0x67);

	std::string resStr = "";

	ArrayToString(vChar, resStr);
	std::cout << resStr << std::endl;
	resStr.clear();

	ArrayToString(lUnsignedChar, resStr);
	std::cout << resStr << std::endl;
	resStr.clear();

	ArrayToString(dUnsignedChar, resStr);
	std::cout << resStr << std::endl;
	resStr.clear();

	ArrayToString(vUnsignedChar, resStr);
	std::cout << resStr << std::endl;
	resStr.clear();

	ArrayToString(dChar, resStr);
	std::cout << resStr << std::endl;
	resStr.clear();

	ArrayToString(dChar, resStr);
	std::cout << resStr << std::endl;
	resStr.clear();

	std::cin.get();
	return 0;
}